﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Guest.Master" AutoEventWireup="True" CodeBehind="Roles.aspx.cs" Inherits="ScrumLite.WebUx.ProjectsViews.Roles" %>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
    function save()
    {
        var role = document.getElementById("role");
        
        if (role.value == "")
        {
            alert("must insert a role name");
            return;
        }
        
        document.forms[0].submit();
    }
    </script>
   <h1>
    <%=ViewData.ProjectName%></h1>
    <hr />
    <h2>Project Roles</h2>
    <br />    
    <form action="<%=Url.Action( new { Controller="Projects", Action="AddRole", projectId = ViewData.ProjectId })%>" method="post">
    <br />
	<div class="actions">
	<a href="javascript:void(0);" onclick="javascript:save();">Add Role to Project</a>&nbsp;
	<%=Html.ActionLink("Cancel", new { Controller="Projects", Action="Team", projectId = ViewData.ProjectId }) %>&nbsp;
	</div>
	<br />
        <table>
        <tr>
        <td valign="top">
            <label for="requestor">
                Role&nbsp;&nbsp;</label><br />
                <input type="text" name="role" id="role" />
        </td>
        <td valign="top">
            <label for="requestor">
                Abilities&nbsp;&nbsp;</label><br />
               <select multiple name="abilities">
               <%
                   foreach (var ability in ViewData.Abilities)
                   {
                %>
                <option value="<%= ability.Id %>"><%= ability.Name %></option>
                <%
                   }
                %>
               </select>
        </td>
        </tr>
        </table>
    </form>        
        <br />
    <div class="formTable">     
    <table cellspacing="0" >
        <tr>
            <th>Role</th>
            <th>Abilities</th>            
        </tr>
    <% foreach (ScrumLite.Services.Contracts.ProjectRole role in ViewData.Roles ) {%>
        <tr>
            <td><%= role.Name %></td>
            <td><%= Html.ActionLink("View...", new { roleId = role.Id.ToString(), Action = "Abilities", Controller = "Projects" } )%></td>            
        </tr>
     <%} %>
    </table>
    </div>
    <br />
	<div class="actions">
	<a href="javascript:void(0);" onclick="javascript:save();">Add Role to Project</a>&nbsp;
	<%=Html.ActionLink("Cancel", new { Controller="Projects", Action="Team", projectId = ViewData.ProjectId }) %>&nbsp;
	</div>
</asp:Content>

